
$(function(){

  var id =window.location.search.substr(4);
  console.log(id);
  $.ajax({
    type:'get',
    url:baseUrl+'hsent-xxyl-user/orderDetail/findOrderDetailsById',
    data:{
      orderId:id
    },
    success:function(res){
      console.log(res);
      var time=new Date().getTime()-res.data.time;
      var hh = Math.floor(time/1000/60/60);
      var mm = Math.floor((time/1000%3600)/60);
      var ss =Math.floor(time/1000-hh*3600-mm*60);
      console.log(hh,mm,ss)
      var aa=JSON.parse(res.data.applySerivceStaffs);
      var details={
        orderDetail:res.data,
        picUrl:picUrl,
        staffs:aa,
        hh:hh,
        mm:mm,
        ss:ss
      };
      var orderCon = template('orderPay', details);
      document.getElementById('include').innerHTML = orderCon;
    }
  });

})

// 取消订单
function clearOrder(id){
  console.log(id);
  $.ajax({
    type:'get',
    url:baseUrl+'hsent-xxyl-user/orderDetail/modifyOrderStatus',
    data:{
      orderId:id,
      status:3
    },
    success:function(res){
      console.log(res);
      if(res.status==1){
        alert('取消成功');
        window.location.href='./myOrder.html';
      }else{
        alert('操作失败,请重试')
      }
    }
  });
}

// 支付
function atPay(item){
    console.log(item);
    window.location.href='./pay.html?id='+item.id;
 }
